<?php

namespace Home\Controller;
use Home\Core\VmsSDK;

class DevlistController extends BaseController
{
    public function index()
    {
        $param = I('get.');
        if(empty(I('get.page'))){
            $param['page']=1;
        }else{
            $param['page']=$_GET['page'];
        }
        $page=$param['page'];
        $param['pagesize'] = PAGE_SIZE;
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::DevList,$param,'GET');
        $array =  json_decode( json_encode( $return ), true );
        $pagesum=$return->pagesum;
        $this->assign('page',$page);
        $this->assign('array',$array);
        $this->assign('pagesum',$pagesum);
        $this->display();
    }
    public function getDevVideo()
    {
        $param = I('get.');
        if(empty(I('get.page'))){
            $param['page']=1;
        }else{
            $param['page']=I('get.page');
        }
        $page=$param['page'];
        if(empty(I('get.starttime'))){
            $param['starttime']=11111111;
        }else{
            $starttime=I('get.starttime');
            $param['starttime']=strtotime($starttime);
        }
        if(empty(I('get.endtime'))){
            $param['endtime']=1513177200;
        }else{
            $endtime=I('get.endtime');
            $param['endtime']=strtotime($endtime);
        }
        $devicemark=$param['devicemark'];
        $param['pagesize'] = PAGE_SIZE;
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::DevVideo,$param,'GET');
        $array =  json_decode( json_encode( $return ), true );
        $pagesum=$return->pagesum;
        $this->assign('page',$page);
        $this->assign('array',$array);
        $this->assign('pagesum',$pagesum);
        $this->assign('devicemark',$devicemark);
        $this->display();
    }


}